from cajparser import CAJParser


def caj_info(caj_file):
    caj = CAJParser(caj_file)
    if caj.format == "PDF" or caj.format == "KDH":
        return f"CAJ文件：{caj_file}\nCAJ类型：{caj.format}\n"
    else:
        return f"CAJ文件：{caj_file}\nCAJ类型：{caj.format}\nCAJ页数：{caj.page_num}\nCAJ轮廓: {caj.toc_num}\n"


def caj_to_pdf(caj_file, pdf_file):
    caj = CAJParser(caj_file)
    caj.convert(pdf_file)


if __name__ == '__main__':
    caj_to_pdf(r'大学校园交通优化设计研究_郭选琴.caj','00.pdf')